package com.testspring.service;

import com.handspring.MyAutowired;
import com.handspring.MyBeanNameAware;
import com.handspring.MyComponent;
import com.handspring.MyScope;
import com.testspring.ZhengValue;
import com.testspring.service.OrderService;
import com.testspring.service.UserInterface;
import com.testspring.service.UserService;

/**
 * @author: ztl
 * @date: 2024/05/08 22:33
 * @desc:
 */

@MyComponent("userServiceAop")
@MyScope("prototype")
public class UserServiceTestAop implements UserInterface, MyBeanNameAware {

    private String beanName;

    /**
     * 我希望我这个自定义的注解的功能是，把aaa赋值给test
     */
    @ZhengValue("aaa")
    private String test;

    @MyAutowired
    private OrderService orderService;

    @Override
    public void test() {
//        System.out.println(orderService);
        System.out.println(test);
    }

    /**
     * 手写的spring中的beanNameAware的回调方法
     * @param name
     */
    @Override
    public void setBeanName(String name) {
        this.beanName = beanName;
    }
}
